;***************************************** ;Project title: 64 LED Matrix Controller * ;Version 1: 1.0 * ;Written By: MSHH * ;Dated: 01/04/2019 * ;For PIC: PIC18F2523 * ;Clock Freq: 10.000MHz * ;***************************************** ; PROGRAM FUNCTION: To Write Data to the EEPROM (Electrically Erasible & Programmable ->>>> 'READ-ONLY-MEMORY')CHIP. ; This Data is permanently stored, to be later retrieved and displayed on the LEDs using the "Eprom Read Program.asm" List P=18F2523 #include Config OSC = HSPLL Config PWRT = OFF Config BOREN = OFF Config WDT = OFF Config PBADEN = OFF Config MCLRE = OFF ;============ ; Declarations: cycle2 equ 100 cycle6 equ 101 cycle200 equ 102 count2 equ 103 count10 equ 104 count195 equ 105 addresshigh equ 106 addresslow equ 107 databyte equ 108 ctrlbytein equ 109 ctrlbyteout equ 10A #define CLK_5917 PORTA,5 #define ED1_5917 PORTA,4 #define ED2_5917 PORTA,3 org 0x000 clrf PCLATH goto Start ;============ ; Subroutines: Init clrf PORTA,0 ; clears Port A clrf PORTB,0 ; clears Port B clrf PORTC,0 ; clears Port C ;************TRIS Registers are used to designate whether port pins will be used as inputs or outputs.***************** ;************ Input = logic '1'; Output = logic '0'******************************************************************** movlw b'11000000' ; Set RA0 to RA5 so they movwf TRISA,0 ; function as outputs. movlw b'00000000' ; Set PortB ports so they movwf TRISB,0 ; function as outputs. movlw b'00000000' ; Set PortC ports so they movwf TRISC,0 ; function as outputs. ;***********INTCON Register is used to turn interrupts on/off. As I'm not using them, so I turned them off.************ movlw b'11000000' ; Disables all interrupts. movwf INTCON,0 ; bcf SSPCON1,SSPEN,0 ; Disables serial port. ;***********T0CON Register is used to set up TMR0 Timer. Timer derives speed from a quarter of main oscillator********* ;***********(Fosc/4 = 2.5 Mhz). 2.5 Mhz = 2500000 oscillations per second. Prescalers allow speed to reduced*********** ;***********(by upto 256x) to something more usable - about 10000 cycles per second when prescaled to 256.************* movlw b'11000100' ; Set up TMR0 Timer. movwf T0CON,0 ; Timer0 enabled; 8-bit config; CLKO; Prescaled to 32. movlw b'00000000' ; Turns off CVRef. movwf CVRCON,0 ; ;******************************I2C Register Initialisation***************************** movlw b'10000000' ; Set bit 7 (SMP:Slew Rate Control) to 1, which disables movwf SSPSTAT,0 ; slew rate control for Standard Speed mode. movlw b'00101000' ; Bit 5: Enables Serial Port for MSSP. movwf SSPCON1,0 ; Bit 3: Enables I2C Master Mode. movlw 0x024 movwf SSPADD,0 movlw b'00011000' ; Setup RC3 & RC4 so they function as inputs. movwf TRISC,0 ; Setup RC0 - RC2 & RC5 - RC7 as outputs. movlw b'10100110' ;Setup Control Byte Register. Bit 0 = Write Operation Selected (0), movwf ctrlbytein ;bits 1 & 2: Device 0 Selected, Bits 4 - 7: Control Code:1010. movlw b'10100111' ;Setup Control Byte Register. Bit 0 = Read Operation Selected (1), movwf ctrlbyteout ;bits 1 & 2: Device 0 Selected, Bits 4 - 7: Control Code:1010. movlw b'00000000' ;Setup Address High Byte. Bits 8 - 15 of Address. movwf addresshigh movlw b'00000000' ;Setup Address Low Byte. Bits 7 - 0 of Address. movwf addresslow movlw b'00110011' ;Setup databyte register. movwf databyte ;********************************Time Delay Register Init*************************** call rstcycle2 ; resets cycle2 register. call rstcycle6 ; resets cycle6 register. call rstcycle200 ; resets cycle200 register. movlw d'2' ; sets up count2 register by placing the number movwf count2 ; 2 into it. movlw d'10' ; sets up count10 register by placing the number movwf count10 ; 10 into it. movlw d'195' ; sets up count195 register by placing the number movwf count195 ; 195 into it. retlw 0 ; Returns from subroutine with zero in the working register. ;****************************************************************************************** ;********************************Time Delay Sub-Routines*********************************** ;****************************************************************************************** half_sec clrf TMR0 ; resets TMR0. half_sec1 movf count195,w ; takes number out of count195 subwf TMR0,w ; Since TMR0 is Prescaled to 256, this will give a time ; of: 10MHz/4 = 2.5MHz/32 = 78125Hz per TMR0 clock. ; A count of 195 will give: 400 Hz = 0.0025s. btfss STATUS,Z ; Subtracts 195 from TMR0 and if the result is zero will set ; the zero flag. When btfss tests the zero flag, it skips ; the next instruction if set. goto half_sec1 ; Loops to 'half_sec1'. decfsz cycle200 ; Decrements 'cycle25' and skips next instruction if zero. goto half_sec1 ; Loops to 'half_sec'. call rstcycle200 ; resets cycle200 register. retlw 0 ; Returns from subroutine with zero in the working register. EightThou_sec clrf TMR0 ; resets TMR0. EightThou_sec1 movf count10,w ; Since TMR0 is Prescaled to 256, this will give a time subwf TMR0,w ; of: 10MHz/4 = 2.5MHz/32 = 78125Hz per TMR0 clock. ; A count of 10 will give: 7812.5 Hz = 0.000128s. btfss STATUS,Z ; Subtracts 10 from TMR0 and if the result is zero will set ; the zero flag. When btfss tests the zero flag, it skips ; the next instruction if set. goto EightThou_sec1 ; Loops to 'EightThou_sec1'. retlw 0 ; Returns from subroutine with zero in the working register. ;FiveThou_sec ; clrf TMR0 ; resets TMR0. ;FiveThou_sec1 ; movf count2,w ; Since TMR0 is Prescaled to 256, this will give a time ; subwf TMR0,w ; of: 10MHz/4 = 2.5MHz/256 = 9766Hz per TMR0 clock. ; ; A count of 2 will give: 4883 Hz = 0.0002s. ; btfss STATUS,Z ; Subtracts 2 from TMR0 and if the result is zero will set ; ; the zero flag. When btfss tests the zero flag, it skips ; ; the next instruction if set. ; goto FiveThou_sec1 ; Loops to 'half_sec1'. ; retlw 0 ; Returns from subroutine with zero in the working register. ;*********************************************************************************************** ;*******************************"TLC5917" LED Driver Sub-routine******************************** ;*********************************************************************************************** NormalMode_5917 bsf ED2_5917 ; sets Output Enable pin to high bcf ED1_5917 ; sets LE pin to low bcf CLK_5917 ; sets clock pin to low call EightThou_sec ; creates 0.000128s delay bsf CLK_5917 ; sets clock pin to high call EightThou_sec ; creates 0.000128s delay bcf CLK_5917 ; sets clock pin to low bcf ED2_5917 ; sets Output Enable pin to low call EightThou_sec ; creates 0.000128s delay bsf CLK_5917 ; sets clock pin to high call EightThou_sec ; creates 0.000128s delay bcf CLK_5917 ; sets clock pin to low bsf ED2_5917 ; sets Output Enable pin to high call EightThou_sec ; creates 0.000128s delay loop_norm btg CLK_5917 ; toggles clock pin high to low; low to high call EightThou_sec ; creates 0.000128s delay decfsz cycle6 ; Decrements 'cycle6' and skips next instruction if zero. goto loop_norm ; loops to loop_norm retlw 0 ; Returns from subroutine with zero in the working register. SpecialMode_5917 movlw b'00001000' ; Sets ED2_5917 to High; movwf PORTA ; All other pins set to Low. call EightThou_sec ; creates 0.000128s delay ;************************ CLOCK 0 ****************************** movlw b'00101000' ; Sets ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. call EightThou_sec ; creates 0.000128s delay movlw b'00000000' ; All PORTA pins set to Low. movwf PORTA ; call EightThou_sec ; creates 0.000128s delay ;************************ CLOCK 1 ****************************** movlw b'00100000' ; Sets CLK_5917 to High; movwf PORTA ; All other pins set to Low. call EightThou_sec ; creates 0.000128s delay movlw b'00010000' ; Sets ED2_5917 to High; movwf PORTA ; All other pins set to Low. call EightThou_sec ; creates 0.000128s delay ;************************ CLOCK 2 ****************************** movlw b'00010100' ; Sets ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. call EightThou_sec ; creates 0.000128s delay movlw b'00011000' ; Sets ED2_5917 & ED1_5917 to High; movwf PORTA ; All other pins set to Low. call EightThou_sec ; creates 0.000128s delay ;************************ CLOCK 3 ****************************** movlw b'00011100' ; Sets ED2_5917, ED1_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. call EightThou_sec ; creates 0.000128s delay movlw b'00010000' ; Sets ED2_5917 to High; movwf PORTA ; All other pins set to Low. call EightThou_sec ; creates 0.000128s delay ;************************ CLOCK 4 ****************************** movlw b'00010100' ; Sets ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. call EightThou_sec ; creates 0.000128s delay movlw b'00010000' ; Sets ED2_5917 to High; movwf PORTA ; All other pins set to Low. call EightThou_sec ; creates 0.000128s delay retlw 0 ; Returns from subroutine with zero in the working register. ;**************************LED SUBROUTINES***************************** ; Software for initializing each one of the 64 LEDs on the LED Display. ;********************************************************************** LED_1 call row_1 ; Turns on row 1. call column_1 ; Turns on the first LED Column. retlw 0 ; Returns from subroutine with zero in the working register. LED_2 call row_1 ; Turns on row 1. call column_2 ; Turns on the Second LED Column. retlw 0 ; Returns from subroutine with zero in the working register. LED_3 call row_1 ; Turns on row 1. call column_3 ; Turns on the Third LED Column. retlw 0 ; Returns from subroutine with zero in the working register. LED_4 call row_1 ; Turns on row 1. call column_4 ; Turns on the Fourth LED Column. retlw 0 ; Returns from subroutine with zero in the working register. ;************************ROW SUBROUTINES***************************** ; Software for initializing each of the 8 columns on the LED Display. ;******************************************************************** row_1 movlw b'00001000' ; sets Output Enable pin to low movwf PORTA ; disabling the outputs. movlw b'00000010' ; Places a High on the 4017's reset pin movwf PORTB,0 ; resetting the chip. nop ; no operation. nop ; no operation. movlw b'00000001' ; Places a Hign on the 4017's Clock Pin, so movwf PORTB,0 ; enabling LED Column 1. retlw 0 ; Returns from subroutine with zero in the working register. ;************************COLUMN SUBROUTINES************************* ; Software for initializing each of the 8 columns on the LED Display. ;******************************************************************* column_1 movlw b'00001100' ; Sets SDI_A & ED2_5917 to High & CLK_5917 to Low; movwf PORTA ; All other pins set to Low. ;************************ CLOCK 0 ****************************** movlw b'00101100' ; Sets ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00001000' ; Sets ED2_5917 to High & CLK_5917 to Low; movwf PORTA ; All other pins set to Low. ;************************ CLOCK 1 ****************************** movlw b'00101000' ; Sets SDI_A, ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00001000' ; sets ED2_5917 to High. CLK_5917 to low; movwf PORTA ; All other pins set to Low. ;************************ CLOCK 2 ******************************* movlw b'00101000' ; Sets ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00001000' ; sets ED2_5917 to High. CLK_5917 to low; movwf PORTA ; All other pins set to Low. ;************************ CLOCK 3 ******************************** movlw b'00101000' ; Sets ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00001000' ; sets ED2_5917 to High. CLK_5917 to low; movwf PORTA ; All other pins set to Low. ;************************* CLOCK 4 ******************************* movlw b'00101000' ; Sets ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00001000' ; Sets ED2_5917 to High. CLK_5917 to Low; movwf PORTA ; All other pins set to Low. ;************************** CLOCK 5 ****************************** movlw b'00101000' ; Sets ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00001000' ; Sets ED2_5917 to High. CLK_5917 to Low; movwf PORTA ; All other pins set to Low. ;************************** CLOCK 6 ****************************** movlw b'00101000' ; Sets ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00001000' ; Sets ED2_5917 to High. CLK_5917 to Low; movwf PORTA ; All other pins set to Low. ;************************** CLOCK 7 ***************************** movlw b'00111000' ; Sets ED1_5917, ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00011000' ; Sets ED1_5917 & ED2_5917 to High & CLK_5917 to low; movwf PORTA ; All other pins set to Low. ;************************ Enabling LED Outputs ******************** movlw b'00101000' ; Sets ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00001000' ; Sets ED2_5917 to High. ED1_5917 & CLK_5917 to low; movwf PORTA ; All other pins set to Low. movlw b'00000000' ; sets Output Enable pin to low movwf PORTA ; enabling the outputs. retlw 0 ; Returns from subroutine with zero in the working register. column_2 movlw b'00001000' ; Sets ED2_5917 to High; movwf PORTA ; All other pins set to Low. ;************************ CLOCK 0 ****************************** movlw b'00101000' ; Sets ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00001100' ; Sets SDI_A & ED2_5917 to High & CLK_5917 to Low; movwf PORTA ; All other pins set to Low. ;************************ CLOCK 1 ****************************** movlw b'00101100' ; Sets SDI_A, ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00001000' ; sets ED2_5917 to High. CLK_5917 to low; movwf PORTA ; All other pins set to Low. ;************************ CLOCK 2 ******************************* movlw b'00101000' ; Sets ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00001000' ; sets ED2_5917 to High. CLK_5917 to low; movwf PORTA ; All other pins set to Low. ;************************ CLOCK 3 ******************************** movlw b'00101000' ; Sets ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00001000' ; sets ED2_5917 to High. CLK_5917 to low; movwf PORTA ; All other pins set to Low. ;************************* CLOCK 4 ******************************* movlw b'00101000' ; Sets ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00001000' ; Sets ED2_5917 to High. CLK_5917 to Low; movwf PORTA ; All other pins set to Low. ;************************** CLOCK 5 ****************************** movlw b'00101000' ; Sets ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00001000' ; Sets ED2_5917 to High. CLK_5917 to Low; movwf PORTA ; All other pins set to Low. ;************************** CLOCK 6 ****************************** movlw b'00101000' ; Sets ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00001000' ; Sets ED2_5917 to High. CLK_5917 to Low; movwf PORTA ; All other pins set to Low. ;************************** CLOCK 7 ***************************** movlw b'00111000' ; Sets ED1_5917, ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00011000' ; Sets ED1_5917 & ED2_5917 to High & CLK_5917 to low; movwf PORTA ; All other pins set to Low. ;************************ Enabling LED Outputs ******************** movlw b'00101000' ; Sets ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00001000' ; Sets ED2_5917 to High. ED1_5917 & CLK_5917 to low; movwf PORTA ; All other pins set to Low. movlw b'00000000' ; sets Output Enable pin to low movwf PORTA ; enabling the outputs. retlw 0 ; Returns from subroutine with zero in the working register. column_3 movlw b'00001000' ; Sets ED2_5917 to High; movwf PORTA ; All other pins set to Low. ;************************ CLOCK 0 ****************************** movlw b'00101000' ; Sets ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00001000' ; Sets ED2_5917 to High & CLK_5917 to Low; movwf PORTA ; All other pins set to Low. ;************************ CLOCK 1 ****************************** movlw b'00101000' ; Sets ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00001100' ; sets SDI_A & ED2_5917 to High. CLK_5917 to low; movwf PORTA ; All other pins set to Low. ;************************ CLOCK 2 ******************************* movlw b'00101100' ; Sets SDI_A, ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00001000' ; sets ED2_5917 to High. CLK_5917 to low; movwf PORTA ; All other pins set to Low. ;************************ CLOCK 3 ******************************** movlw b'00101000' ; Sets ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00001000' ; sets ED2_5917 to High. CLK_5917 to low; movwf PORTA ; All other pins set to Low. ;************************* CLOCK 4 ******************************* movlw b'00101000' ; Sets ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00001000' ; Sets ED2_5917 to High & CLK_5917 to Low; movwf PORTA ; All other pins set to Low. ;************************** CLOCK 5 ****************************** movlw b'00101000' ; Sets ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00001000' ; Sets ED2_5917 to High & CLK_5917 to Low; movwf PORTA ; All other pins set to Low. ;************************** CLOCK 6 ****************************** movlw b'00101000' ; Sets ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00001000' ; Sets ED2_5917 to High. CLK_5917 to Low; movwf PORTA ; All other pins set to Low. ;************************** CLOCK 7 ***************************** movlw b'00111000' ; Sets ED1_5917, ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00011000' ; Sets ED1_5917 & ED2_5917 to High & CLK_5917 to low; movwf PORTA ; All other pins set to Low. ;************************ Enabling LED Outputs ******************** movlw b'00101000' ; Sets ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00001000' ; Sets ED2_5917 to High. ED1_5917 & CLK_5917 to low; movwf PORTA ; All other pins set to Low. movlw b'00000000' ; sets Output Enable pin to low movwf PORTA ; enabling the outputs. retlw 0 ; Returns from subroutine with zero in the working register. column_4 movlw b'00001000' ; Sets ED2_5917 to High; movwf PORTA ; All other pins set to Low. ;************************ CLOCK 0 ****************************** movlw b'00101000' ; Sets ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00001000' ; Sets ED2_5917 to High & CLK_5917 to Low; movwf PORTA ; All other pins set to Low. ;************************ CLOCK 1 ****************************** movlw b'00101000' ; Sets ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00001000' ; sets ED2_5917 to High. CLK_5917 to low; movwf PORTA ; All other pins set to Low. ;************************ CLOCK 2 ******************************* movlw b'00101000' ; Sets ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00001100' ; sets SDI_A & ED2_5917 to High. CLK_5917 to low; movwf PORTA ; All other pins set to Low. ;************************ CLOCK 3 ******************************** movlw b'00101100' ; Sets SDI_A, ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00001000' ; sets ED2_5917 to High. CLK_5917 to low; movwf PORTA ; All other pins set to Low. ;************************* CLOCK 4 ******************************* movlw b'00101000' ; Sets ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00001000' ; Sets ED2_5917 to High & CLK_5917 to Low; movwf PORTA ; All other pins set to Low. ;************************** CLOCK 5 ****************************** movlw b'00101000' ; Sets ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00001000' ; Sets ED2_5917 to High & CLK_5917 to Low; movwf PORTA ; All other pins set to Low. ;************************** CLOCK 6 ****************************** movlw b'00101000' ; Sets ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00001000' ; Sets ED2_5917 to High. CLK_5917 to Low; movwf PORTA ; All other pins set to Low. ;************************** CLOCK 7 ***************************** movlw b'00111000' ; Sets ED1_5917, ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00011000' ; Sets ED1_5917 & ED2_5917 to High & CLK_5917 to low; movwf PORTA ; All other pins set to Low. ;************************ Enabling LED Outputs ******************** movlw b'00101000' ; Sets ED2_5917 & CLK_5917 to High; movwf PORTA ; All other pins set to Low. movlw b'00001000' ; Sets ED2_5917 to High. ED1_5917 & CLK_5917 to low; movwf PORTA ; All other pins set to Low. movlw b'00000000' ; sets Output Enable pin to low movwf PORTA ; enabling the outputs. retlw 0 ; Returns from subroutine with zero in the working register. ;*************************************************************************************** ;*********************Subroutines for storing characters onto EEPROM******************** ; Transmit 6 Columns of 8-bit data representing the letter a. letter_a movlw b'00000100' ; Moves First column data for letter a into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00101010' ; Moves Second column data for letter a into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00101010' ; Moves Third column data for letter a into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00101010' ; Moves Fourth column data for letter a into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00011110' ; Moves Fifth column data for letter a into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00000000' ; Moves Sixth column data for 'Space' into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. retlw 0 ; Transmit 6 Columns of 8-bit data representing the letter A. letter_A movlw b'00111110' ; Moves First column data for letter A into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'01001000' ; Moves Second column data for letter A into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'10001000' ; Moves Third column data for letter A into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'01001000' ; Moves Fourth column data for letter A into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00111110' ; Moves Fifth column data for letter A into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00000000' ; Moves Sixth column data for 'Space' into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. retlw 0 ; Transmit 6 Columns of 8-bit data representing the letter c. letter_c movlw b'00011100' ; Moves First column data for letter c into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00100010' ; Moves Second column data for letter c into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00100010' ; Moves third column data for letter c into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00100010' ; Moves fourth column data for letter c into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00000100' ; Moves fifth column data for letter c into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00000000' ; Moves Sixth column data for 'Space' into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. retlw 0 ; Transmit 6 Columns of 8-bit data representing the letter d. letter_d movlw b'00011100' ; Moves First column data for letter d into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00100010' ; Moves Second column data for letter d into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00100010' ; Moves third column data for letter d into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00010010' ; Moves fourth column data for letter d into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'11111110' ; Moves fifth column data for letter d into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00000000' ; Moves Sixth column data for 'Space' into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. retlw 0 ; Transmit 6 Columns of 8-bit data representing the letter D. letter_D movlw b'11111110' ; Moves First column data for letter D into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'10000010' ; Moves Second column data for letter D into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'10000010' ; Moves third column data for letter D into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'01000100' ; Moves fourth column data for letter D into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00111000' ; Moves fifth column data for letter D into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00000000' ; Moves Sixth column data for 'Space' into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. retlw 0 ; Transmit 6 Columns of 8-bit data representing the letter e. letter_e movlw b'00011100' ; Moves First column data for letter e into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00101010' ; Moves Second column data for letter e into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00101010' ; Moves third column data for letter e into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00101010' ; Moves fourth column data for letter e into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00011000' ; Moves fifth column data for letter e into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00000000' ; Moves Sixth column data for 'Space' into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. retlw 0 ; Transmit 6 Columns of 8-bit data representing the letter E. letter_E movlw b'11111110' ; Moves First column data for letter E into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'10010010' ; Moves Second column data for letter E into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'10010010' ; Moves third column data for letter E into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'10010010' ; Moves fourth column data for letter E into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'10000010' ; Moves fifth column data for letter E into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00000000' ; Moves Sixth column data for 'Space' into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. retlw 0 ; Transmit 6 Columns of 8-bit data representing the letter g. letter_g movlw b'00010000' ; Moves First column data for letter g into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00101010' ; Moves Second column data for letter g into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00101010' ; Moves third column data for letter g into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00101010' ; Moves fourth column data for letter g into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00111100' ; Moves fifth column data for letter g into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00000000' ; Moves Sixth column data for 'Space' into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. retlw 0 ; Transmit 6 Columns of 8-bit data representing the letter H. letter_H movlw b'11111110' ; Moves First column data for letter H into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00010000' ; Moves Second column data for letter H into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00010000' ; Moves third column data for letter H into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00010000' ; Moves fourth column data for letter H into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'11111110' ; Moves fifth column data for letter H into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00000000' ; Moves Sixth column data for 'Space' into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. retlw 0 ; Transmit 6 Columns of 8-bit data representing the letter h. letter_h movlw b'11111110' ; Moves First column data for letter h into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00010000' ; Moves Second column data for letter h into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00100000' ; Moves third column data for letter h into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00100000' ; Moves fourth column data for letter h into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00011110' ; Moves fifth column data for letter h into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00000000' ; Moves Sixth column data for 'Space' into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. retlw 0 ; Transmit 6 Columns of 8-bit data representing the letter i. letter_i movlw b'00000000' ; Moves First column data for letter i into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00010010' ; Moves Second column data for letter i into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'10111110' ; Moves third column data for letter i into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00000010' ; Moves fourth column data for letter i into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00000000' ; Moves fifth column data for letter i into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00000000' ; Moves Sixth column data for 'Space' into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. retlw 0 ; Transmit 6 Columns of 8-bit data representing the letter M. letter_M movlw b'11111110' ; Moves first column data for letter M into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit movlw b'01000000' ; Moves second column data for letter M into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00110000' ; Moves third column data for letter M into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'01000000' ; Moves fourth column data for letter M into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'11111110' ; Moves fifth column data for letter M into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00000000' ; Moves Sixth column data for 'Space' into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. retlw 0 ; Transmit 6 Columns of 8-bit data representing the letter n. letter_n movlw b'00111110' ; Moves first column data for letter n into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit movlw b'00010000' ; Moves second column data for letter n into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00100000' ; Moves third column data for letter n into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'0010000' ; Moves fourth column data for letter n into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00011110' ; Moves fifth column data for letter n into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00000000' ; Moves Sixth column data for 'Space' into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. retlw 0 ; Transmit 6 Columns of 8-bit data representing the letter o. letter_o movlw b'00011100' ; Moves first column data for letter o into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit movlw b'00100010' ; Moves second column data for letter o into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00100010' ; Moves third column data for letter o into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00100010' ; Moves fourth column data for letter o into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00011100' ; Moves fifth column data for letter o into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00000000' ; Moves Sixth column data for 'Space' into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. retlw 0 ; Transmit 6 Columns of 8-bit data representing the letter r. letter_r movlw b'00111110' ; Moves first column data for letter r into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit movlw b'00010000' ; Moves second column data for letter r into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00100000' ; Moves third column data for letter r into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00100000' ; Moves fourth column data for letter r into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00010000' ; Moves fifth column data for letter r into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00000000' ; Moves Sixth column data for 'Space' into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. retlw 0 ; Transmit 6 Columns of 8-bit data representing the letter s. letter_s movlw b'00010010' ; Moves first column data for letter s into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit movlw b'00101010' ; Moves second column data for letter s into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00101010' ; Moves third column data for letter s into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00101010' ; Moves fourth column data for letter s into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00000100' ; Moves fifth column data for letter s into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00000000' ; Moves Sixth column data for 'Space' into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. retlw 0 ; Transmit 6 Columns of 8-bit data representing the letter t. letter_t movlw b'00100000' ; Moves First column data for letter t into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'11111100' ; Moves Second column data for letter t into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00100010' ; Moves third column data for letter t into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00000010' ; Moves fourth column data for letter t into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00000000' ; Moves fifth column data for 'Space' into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. retlw 0 ; Transmit 6 Columns of 8-bit data representing the letter T. letter_T movlw b'10000000' ; Moves First column data for letter T into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'10000000' ; Moves Second column data for letter T into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'11111110' ; Moves third column data for letter T into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'10000000' ; Moves fourth column data for letter T into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'10000000' ; Moves fifth column data for letter T into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00000000' ; Moves sixth column data for 'Space' into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. retlw 0 ; Transmit 6 Columns of 8-bit data representing the letter w. letter_w movlw b'00111100' ; Moves First column data for letter w into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00000010' ; Moves Second column data for letter w into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00001100' ; Moves third column data for letter w into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00000010' ; Moves fourth column data for letter w into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00111100' ; Moves fifth column data for letter W into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00000000' ; Moves sixth column data for 'Space' into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. retlw 0 space_1 movlw b'00000000' ; Moves one column of data into the working register call DataTransmit ; to create a 'space', then sends this Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00000000' ; Moves one column of data into the working register call DataTransmit ; to create a 'space', then sends this Data Byte. call CheckACK ; Check for Acknowledge Bit. retlw 0 ;*************************************************************************************** ;******************************"Reset Time-Delay" Sub-routines************************** ;*************************************************************************************** rstcycle2 movlw d'2' ; places the number '2' into the cycle25 register. movwf cycle2 ; return ; returns from subroutine. rstcycle6 movlw d'6' ; places the number '6' into the cycle25 register. movwf cycle6 ; return ; returns from subroutine. rstcycle200 movlw d'200' ; places the number '200' into the cycle25 register. movwf cycle200 ; return ; returns from subroutine. ;***************************************************************************************** ;*************************I2C (EPROM) Driver Sub-routines********************************* ;***************************************************************************************** IdleBusCheck ; This subroutine checks a number of bits on the SSPCON2 Register to check ; that the data bus is currently idle. If the bus is not idle then one or ; more bits will be set. If a particular bit is clear then that bit is idle. NotIdle btfsc SSPCON2, ACKEN ; Bit Tests: "Acknowledge Sequence Enable bit" & skips goto NotIdle ; next instruction if clear. Loops to NotIdle if set. btfsc SSPCON2, RCEN ; Bit Tests: "Receive Enable bit" & skips next instr/n goto NotIdle ; if clear. Loops to NotIdle if set. btfsc SSPCON2, PEN ; Bit Tests: "Stop Condition Enable bit" & skips next goto NotIdle ; instr/n if clear. Loops to NotIdle if set. btfsc SSPCON2, RSEN ; Bit Tests: "Repeated Start Condition Enable bit" goto NotIdle ; skips next instr/n if clear. Loops to NotIdle if set. btfsc SSPCON2, SEN ; Bit Tests: "Start Condition Enable" & skips next Instr goto NotIdle ; if clear. Loops to NotIdle if set. retlw 0 ; Returns from subroutine with zero in the working register. SendStartBit bsf SSPCON2, SEN, 0 ; Enables Start condition, so a start bit is placed on Portc. call WaitMSSP ; Checks for completed I2C Operation. retlw 0 ; Returns from subroutine with zero in the working register. DataTransmit movwf SSPBUF ; Place data into the SSPBUF Register. call WaitMSSP ; Checks for completed I2C Operation. retlw 0 ; Returns from subroutine with zero in the working register. DataReceive bsf SSPCON2,RCEN ; Receive Mode (I2C) Enabled on MSSP Module. call WaitMSSP ; Checks for completed I2C Operation. retlw 0 ; Returns from subroutine with zero in the working register. CheckACK btfsc SSPCON2, ACKSTAT call FailedACK retlw 0 ; Returns from subroutine with zero in the working register. SendNack bsf SSPCON2,ACKDT ; bsf SSPCON2,ACKEN ; retlw 0 ; Returns from subroutine with zero in the working register. RepeatStart bsf SSPCON2, RSEN call WaitMSSP ; Checks for completed I2C Operation. retlw 0 ; Returns from subroutine with zero in the working register. WaitMSSP btfss PIR1,SSPIF,0 ; Check for completed I2C Operation. goto WaitMSSP ; Operation not completed. bcf PIR1,SSPIF,0 ; Operation completed, I2C Ready. retlw 0 ; Returns from subroutine with zero in the working register. FailedACK bsf SSPCON2,PEN ; call WaitMSSP Loop_1 call LED_1 ; goto Loop_1 ; Continually Loop at this point. SendStopBit bsf SSPCON2, PEN call WaitMSSP return ; returns from subroutine. ; Program Start: Start call Init call NormalMode_5917 ; Sets up 5917 IC so that it is in normal mode. Main ;*******************************The I2C Driver Software********************************* ;***********************************Write to EEPROM************************************* call IdleBusCheck ; Check that the data bus is currently idle. call SendStartBit ; Sends Start Bit to Start Write Sequence. movf ctrlbytein,w ; Moves write control byte into working register. call DataTransmit ; Send Control Bit call CheckACK ; Check for Acknowledge Bit movf addresshigh,w ; Moves Address High Byte into working register. call DataTransmit ; Send Address High Byte call CheckACK ; Check for Acknowledge Bit movf addresslow,w ; Moves Address Low Byte into working register. call DataTransmit ; Send Address Low Byte call CheckACK ; Check for Acknowledge Bit call space_1 ; Creates a space between words. (02) call space_1 ; Creates a space between words. (04) call space_1 ; Creates a space between words. (06) call space_1 ; Creates a space between words. (08) call letter_M ; Jumps to letter M Subroutine (14) call letter_a ; Jumps to letter a Subroutine (20) call letter_t ; Jumps to letter t Subroutine (26) call letter_t ; Jumps to letter t Subroutine (32) call letter_h ; Jumps to letter h Subroutine (38) call letter_e ; Jumps to letter e Subroutine (44) call letter_w ; Jumps to letter w Subroutine (50) call space_1 ; Creates a space between words. (52) call letter_H ; Jumps to letter H Subroutine (58) call letter_a ; Jumps to letter a Subroutine (64) call letter_r ; Jumps to letter r Subroutine (70) call letter_r ; Jumps to letter r Subroutine (76) call letter_i ; Jumps to letter i Subroutine (82) call letter_s ; Jumps to letter s Subroutine (88) call letter_o ; Jumps to letter o Subroutine (94) call letter_n ; Jumps to letter n Subroutine (100) call space_1 ; Creates a space between words. (102) call letter_T ; Jumps to letter T Subroutine (108) call letter_e ; Jumps to letter e Subroutine (114) call letter_s ; Jumps to letter s Subroutine (120) call letter_t ; Jumps to letter t Subroutine (126) call space_1 ; Creates a space between words. (128) call SendStopBit ; Send Stop Bit to End Write Sequence. ; ************************************************************** ; Section for writing data to Bytes 128 thru 255. ;*************************************************************** call half_sec ; wait half of a second. movlw b'10000000' ;Setup Address Low Byte. Bits 7 - 0 of Address. movwf addresslow call IdleBusCheck ; Check that the data bus is currently idle. call SendStartBit ; Sends Start Bit to Start Write Sequence. movf ctrlbytein,w ; Moves write control byte into working register. call DataTransmit ; Send Control Bit call CheckACK ; Check for Acknowledge Bit movf addresshigh,w ; Moves Address High Byte into working register. call DataTransmit ; Send Address High Byte call CheckACK ; Check for Acknowledge Bit movf addresslow,w ; Moves Address Low Byte into working register. call DataTransmit ; Send Address Low Byte call CheckACK ; Check for Acknowledge Bit call letter_a ; Jumps to letter a Subroutine (06) call letter_n ; Jumps to letter n Subroutine (12) call letter_d ; Jumps to letter d Subroutine (18) call space_1 ; Creates a space between words. (20) call letter_D ; Jumps to letter D Subroutine (26) call letter_i ; Jumps to letter i Subroutine (32) call letter_a ; Jumps to letter a Subroutine (38) call letter_g ; Jumps to letter g Subroutine (44) call letter_n ; Jumps to letter n Subroutine (50) call letter_o ; Jumps to letter o Subroutine (56) call letter_s ; Jumps to letter s Subroutine (62) call letter_t ; Jumps to letter t Subroutine (68) call letter_i ; Jumps to letter i Subroutine (74) call letter_c ; Jumps to letter c Subroutine (80) call space_1 ; Creates a space between words. (82) call letter_E ; Jumps to letter E Subroutine (88) call letter_n ; Jumps to letter n Subroutine (94) call letter_g ; Jumps to letter g Subroutine (100) call letter_i ; Jumps to letter i Subroutine (106) call letter_n ; Jumps to letter n Subroutine (112) call letter_e ; Jumps to letter e Subroutine (118) call letter_e ; Jumps to letter e Subroutine (124) ; Transmits first 4 Columns of 8-bit data representing the letter r. movlw b'00111110' ; Moves first column data for letter r into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit movlw b'00010000' ; Moves second column data for letter r into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00100000' ; Moves third column data for letter r into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00100000' ; Moves fourth column data for letter r into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. call SendStopBit ; Send Stop Bit to End Write Sequence. ; ************************************************************** ; Section for writing data to Bytes 256 thru 383. ;*************************************************************** call half_sec ; wait half of a second. movlw b'00000000' ;Setup Address Low Byte. Bits 7 - 0 of Address. movwf addresslow movlw b'00000001' ;Setup Address Low Byte. Bits 7 - 0 of Address. movwf addresshigh call IdleBusCheck ; Check that the data bus is currently idle. call SendStartBit ; Sends Start Bit to Start Write Sequence. movf ctrlbytein,w ; Moves write control byte into working register. call DataTransmit ; Send Control Bit call CheckACK ; Check for Acknowledge Bit movf addresshigh,w ; Moves Address High Byte into working register. call DataTransmit ; Send Address High Byte call CheckACK ; Check for Acknowledge Bit movf addresslow,w ; Moves Address Low Byte into working register. call DataTransmit ; Send Address Low Byte call CheckACK ; Check for Acknowledge Bit ; Transmits last 2 Columns of 8-bit data representing the letter r. movlw b'00010000' ; Moves fifth column data for letter r into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. movlw b'00000000' ; Moves Sixth column data for 'Space' into the call DataTransmit ; working register, then sends the Data Byte. call CheckACK ; Check for Acknowledge Bit. call space_1 ; Creates a space between words. (04) call space_1 ; Creates a space between words. (06) call space_1 ; Creates a space between words. (08) call space_1 ; Creates a space between words. (10) call SendStopBit ; Send Stop Bit to End Write Sequence. loop_A call half_sec call LED_4 call half_sec call LED_1 goto loop_A goto Main ; loops to Main. END